package com.exprecards.common.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.exprecards.common.util.MailSenderUtils;

/**
 * Servlet implementation class ContactenosServlet
 */
public class ContactenosServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ContactenosServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		MailSenderUtils.getInstance().enviarNotificacionContactenos(
				request.getParameter("empresa"),
				request.getParameter("direccion"), request.getParameter("nit"),
				request.getParameter("personaContacto"),
				request.getParameter("email"),
				request.getParameter("telefonoFijo"),
				request.getParameter("telefonoCelular"),
				request.getParameter("message"));

		try {
			response.sendRedirect("/EXPRECARDS/portalWeb/webPage/contactenosRespuesta.html");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
